<?php
/**
 * 
 */

/**
 * 
 */

/**
 * Template Class, Defines what a template should have visible to templaters
 *
 * @author anthony
 */
abstract class Template {
    /**
     * Main Content Feed 
     */
    abstract public function maincontent_feed($feed_title, $feed_url, array $feed_items, $rss_html = false);
    
    /**
     * Lead maintainer box 
     */
    abstract public function makeleadmaintainerbox($lead_uid, $maintainers);
    
    /**
     * Create a twitter feed from the specified username and theme colours
     * @param string $username
     * @param string $theme_bg - Styling
     * @param string $theme_col - Styling
     * @param string $tweets_bg - Styling
     * @param string $tweets_col - Styling
     * @param string $tweets_link - Styling
     * @return string 
     */
    public function maketwitterFeed($username, $theme_bg, $theme_col, $tweets_bg, $tweets_col, $tweets_link) {
	return <<<EOHD
	    <script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
		<script>
		new TWTR.Widget({
		version: 2,
		type: 'profile',
		rpp: 4,
		interval: 30000,
		width: 250,
		height: 300,
		theme: {
		    shell: {
		    background: '{$theme_bg}',
		    color: '{$theme_col}'
		    },
		    tweets: {
		    background: '{$tweets_bg}',
		    color: '{$tweets_col}',
		    links: '{$tweets_link}'
		    }
		},
		features: {
		    scrollbar: false,
		    loop: false,
		    live: false,
		    behavior: 'all'
		}
		}).render().setUser('{$username}').start();
		</script>
EOHD;
    }
    
    /**
     * Make a feed item for a page with many things in a list, such as the home page or search results.
     * @param string $date
     * @param string $title
     * @param string $uri
     * @param string $description
     * @param string $icon
     * @return type 
     */
    public function makecontentfeeditem($date, $title, $uri, $description, $icon = false) {
	$image = '';
	if($icon !== false) {
	    $image = '<div style="width: 100%; text-align: center;"><a href="'.$uri.'"><img src="'.$icon.'" style="width: 40px; height: 40px; border: 0px solid none;" /></a></div>';
	}
	return array(
	    'date' => $date,
	    'title' => $title,
	    'uri' => $uri,
	    'description' => $description,
	    'icon' => $image
	);
    }
    
    /**
     * Create the smaller section on the right 
     */
    abstract public function createSidebarItem($title, $html);
    
    /**
     * Make a generic hero unit with a title and some html
     * @param string $title
     * @param string $htmlblock1
     * @param string $htmlblock2
     * @return type 
     */
    public function makeherounit($title, $htmlblock1, $htmlblock2) {
	return <<<EOH
	    <div class="hero-unit">
		<h1>{$title}</h1>
		<p>{$htmlblock1}</p>
		<p>{$htmlblock2}</p>
	    </div>
EOH;
    }
    
    /**
     * Project Unit (abs) 
     */
    abstract public function makeprojectunit($title, $icon, $htmlblock1, $htmlblock2);
    
    /**
     * Generate the html for the two requirement types 
     */
    abstract public function makedependencyrow($requirement_bool, $requirement_array);
    
    /**
     * Should add a comment to the page
     */
    abstract public function makeusercomment($commentObject);
    
    /**
     * Get the Image for the rating of the project 
     */
    abstract public function getRatingImage($averageRating);
    
    /**
     * Generate the Rating HTML (AJAX) 
     */
    abstract public function AJAX_ratingButton($alias);
    
    /**
     * TODO: Func
     */
    abstract public function makeEditDiv($text, $base_url, $alias);
    
    /**
     * Create a tooltip to display and add the JS
     * @param string $js_cb
     * @param string $class - 'helpToolTip' by default
     * @return type 
     */
    public function create_tooltip($js_cb, $class = 'helpToolTip') {
	return '<sup>[<span class="'.$class.'" onclick="ToolTip.display(\''.$js_cb.'\');"> ? </span>]</sup>';
    }
    
    /**
     * Create HTML for a search box for projects 
     */
    abstract public function project_searchbox();
}

?>
